<template>
  <custom-layout>
    <view class="profileInfo">
      <view class="header-card" :style="{ paddingTop: `${navBarHeight}px` }">
        <view class="header-content" @click="navigate('info')">
          <image class="avatar" src="@/static/avatar.jpg" mode="aspectFit" :draggable="false"></image>
          <view class="info-card">
            <text class="name">ziye</text>
            <view class="desc"> ID 123456 </view>
          </view>
        </view>
      </view>

      <view class="content-card">
        <view class="menu-list">
          <view class="menu-item">
            <uni-icons type="heart" color="#409eff" size="18" />
            <view class="label">关于我们</view>
          </view>
          <view class="menu-item">
            <uni-icons type="gear" color="#409eff" size="18" />
            <view class="label">设置</view>
          </view>
        </view>
      </view>
    </view>
  </custom-layout>
</template>

<script>
export default {
  data() {
    return {
      navBarHeight: 0,
    };
  },
  onLoad() {
    const { navBarHeight, statusBarHeight } = getApp().globalData.systemInfo;
    this.navBarHeight = navBarHeight + statusBarHeight;
  },
  mounted() {},
  methods: {
    navigate(url) {
      this.$tab.push(url);
    },
  },
};
</script>

<style lang="scss" scoped>
.profileInfo {
  width: 100%;

  .header-card {
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(to top, transparent, #409eff);

    .header-content {
      padding: 32px 16px 80px 16px;
      box-sizing: border-box;
    }
  }
  .content-card {
    width: 100%;
    top: -40px;
    position: relative;
    background-color: transparent;
    padding: 16px;
    box-sizing: border-box;
  }
}
.profileInfo .header-content {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: row;
  align-items: flex-start;

  .avatar {
    width: 50px;
    height: 50px;
    border-radius: 4px;
  }

  .info-card {
    width: 100%;
    padding-left: 16px;
    box-sizing: border-box;

    .name {
      width: 100%;
      font-size: 18px;
      font-weight: 600;
      color: #303133;
    }

    .desc {
      width: 100%;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      font-size: 14px;
      padding: 8px 0px;
      box-sizing: border-box;
      color: #606266;
      padding-right: 8px;
      box-sizing: border-box;
    }
  }
}

.profileInfo .menu-list {
  background-color: #fff;
  border-radius: 4px;

  .menu-item {
    padding: 12px 16px;
    box-sizing: border-box;
    position: relative;
    font-size: 14px;
    display: flex;
    flex-direction: row;
    align-items: center;

    .label {
      padding-left: 4px;
      box-sizing: border-box;
    }

    &:not(:last-child) {
      border-bottom: 1px solid #f0f0f0;
    }
    &::before {
      content: " ";
      right: 16px;
      top: calc(50% - 5px);
      height: 10px;
      width: 10px;
      border-width: 2px 2px 0 0;
      border-color: silver;
      border-style: solid;
      -webkit-transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
      transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
      position: absolute;
    }
  }
}
</style>
